<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<div class="container-fluid am-margin-top">
    <form id="optBtnForm">
        <input type="hidden" name="id"/>
        <input type="hidden" name="funcPointId"/>
        <input type="hidden" name="optAuthId">
        <input type="hidden" name="indexValue">
        <div class="form-group">
            <label>按钮标题</label>
            <input type="text" name="title" class="form-control" >
        </div>
        <div class="form-group">
            <label>不显示标题</label>
            <input type="checkbox" name="notDisplayTitle" value="1">
        </div>
        <div class="form-group">
            <label>类型</label>
            <select class="form-control" name="btnType">
               	<pf:dataDic var="item" dicCode="BTN_TYPE">
                          <option value="${item.code}">${item.name}</option>
                      </pf:dataDic>
               </select>
        </div>
        <div class="form-group">
            <label>按钮class</label>
            <input type="text" name="btnCls"  class="form-control">
        </div>
        <div class="form-group">
            <label>图标class</label>
            <input type="text" name="iconCls"  class="form-control">
        </div>
        <div class="form-group">
            <label>权限标识</label>
            <input type="text" name="optAuthCode"  class="form-control">
        </div>
        <div class="form-group">
            <label>脚本</label>
            <input type="text" name="exeScript"  class="form-control">
        </div>
        <div class="form-group">
        	<a href="javascript:void(0)" id="optBtnSaveBt"  class="btn btn-primary pull-right">保存</a>
    	</div>
    </form>
</div>
<script type="text/javascript">

    $(function () {
        var id = '${param.id}';
        var funcPointId = '${param.funcPointId}';
        $("#optBtnForm").find("input[name=funcPointId]").val(funcPointId);

        //初始化
        if (id) {
            $.getJSON(ctx + '/optBtnAction/findById.do', {id: id}, function (data) {
                webUtils.fullForm({
                    form: $("#optBtnForm"),
                    data: data
                });
            });
        }
        //事件
        $("#optBtnSaveBt").click(function () {
            $("#optBtnForm").ajaxSubmit({
                url: ctx + '/optBtnAction/save.do',
                data: {},
                type: "POST",
                success: function (data) {
                    if (data.success) {
                        webUtils.alert("提交成功");
                        top.webUtils.topicPublish("optBtn.edit.success", data);
                    } else {
                    	webUtils.error(data.msg);
                    }
                }
            });
        });
    });
</script>